home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / gas-211 / gas / subsegs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-30  |  3.2 KB  |  104 lines

  1. /* subsegs.h -> subsegs.c
  2.  
  3.    Copyright (C) 1987, 1992 Free Software Foundation, Inc.
  4.  
  5.    This file is part of GAS, the GNU Assembler.
  6.  
  7.    GAS is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 2, or (at your option)
  10.    any later version.
  11.  
  12.    GAS is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with GAS; see the file COPYING.  If not, write to
  19.    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /*
  22.  * For every sub-segment the user mentions in the ASsembler program,
  23.  * we make one struct frchain. Each sub-segment has exactly one struct frchain
  24.  * and vice versa.
  25.  *
  26.  * Struct frchain's are forward chained (in ascending order of sub-segment
  27.  * code number). The chain runs through frch_next of each subsegment.
  28.  * This makes it hard to find a subsegment's frags
  29.  * if programmer uses a lot of them. Most programs only use text0 and
  30.  * data0, so they don't suffer. At least this way:
  31.  * (1)    There are no "arbitrary" restrictions on how many subsegments
  32.  *    can be programmed;
  33.  * (2)    Subsegments' frchain-s are (later) chained together in the order in
  34.  *    which they are emitted for object file viz text then data.
  35.  *
  36.  * From each struct frchain dangles a chain of struct frags. The frags
  37.  * represent code fragments, for that sub-segment, forward chained.
  38.  */
  39.  
  40. struct frchain            /* control building of a frag chain */
  41. {                /* FRCH = FRagment CHain control */
  42.   struct frag *frch_root;    /* 1st struct frag in chain, or NULL */
  43.   struct frag *frch_last;    /* last struct frag in chain, or NULL */
  44.   struct frchain *frch_next;    /* next in chain of struct frchain-s */
  45.   segT frch_seg;        /* SEG_TEXT or SEG_DATA. */
  46.   subsegT frch_subseg;        /* subsegment number of this chain */
  47. };
  48.  
  49. typedef struct frchain frchainS;
  50.  
  51. /* All subsegments' chains hang off here.  NULL means no frchains yet.  */
  52. extern frchainS *frchain_root;
  53.  
  54. /* Frchain we are assembling into now That is, the current segment's
  55.    frag chain, even if it contains no (complete) frags. */
  56. extern frchainS *frchain_now;
  57.  
  58.  
  59. typedef struct
  60. {
  61.   frchainS *frchainP;
  62.   int hadone;
  63.   int user_stuff;
  64.   fixS *fix_root;
  65.   fixS *fix_tail;
  66. #if defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER)
  67.   struct internal_scnhdr scnhdr;
  68. #endif
  69.   symbolS *dot;
  70.  
  71.   struct lineno_list *lineno_list_head;
  72.   struct lineno_list *lineno_list_tail;
  73.  
  74. #ifdef BFD_ASSEMBLER
  75.   asection *bfd_section;
  76. #endif
  77. } segment_info_type;
  78.  
  79. #ifdef BFD_ASSEMBLER
  80.  
  81. #define seg_info(SEC)    \
  82.     ((segment_info_type *) bfd_get_section_userdata (stdoutput, (SEC)))
  83.  
  84. #else /* ! BFD_ASSEMBLER */
  85.  
  86. #ifdef MANY_SEGMENTS
  87.  
  88. extern segment_info_type segment_info[];
  89.  
  90. #define seg_info(SEC)    (&segment_info[SEC])
  91.  
  92. #else
  93.  
  94. /* Sentinel for frchain crawling.  Points to the 1st data-segment
  95.    frchain.  (Which is pointed to by the last text-segment frchain.) */
  96. extern frchainS *data0_frchainP;
  97. extern frchainS *bss0_frchainP;
  98.  
  99. #endif
  100.  
  101. #endif /* ! BFD_ASSEMBLER */
  102.  
  103. /* end of subsegs.h */
  104.